
#!/bin/ksh

[ "$1" = "" ] && {

echo Usage: tolower file_or_dir_list

exit 1

}

find $* -depth -name "*[A-Z]*" -print | while read src ; do

prefix=${src%/*}/

base=${src##*/}

[ "$src" = "$base" ] && prefix=

dst="$prefix"`echo "$base" | tr "A-Z" "a-z"`

[ "$src" = "$dst" ] && {

echo $file already is a lower case file name

continue

}

[ -e "$dst" ] && {

echo $file already exist, $src not changed

continue

}

echo Processing $src

mv "$src" "$dst"

done

